<template>
  <el-menu :default-openeds="opens" style="overflow-x: hidden; min-height: 100%;"
           background-color="rgb(48, 41, 62)"
           text-color="#fff"
           active-text-color="#ffd04b"
           :collapse-transition="false"
           :collapse="isCollapse"
           class="el-meun-vertical-demo"
           router
  >
    <div style="height: 60px; line-height: 60px; text-align: center">
      <img src="../assets/icon2.png" alt="" style="width: 25px;">
      <b style="color: white; position: relative; left: 5px" v-show="logoTextShow">后台管理系统</b>
    </div>
    <div v-for="item in menus" :key="item.id">
      <div v-if="item.path">
        <el-menu-item :index="item.path">
          <i :class="item.icon"></i>
          <span slot="title"> {{item.name}} </span>
        </el-menu-item>
      </div>
      <div v-else>
        <el-submenu :index="item.id + ''">
          <template slot="title">
            <i :class="item.icon"></i>
            <span slot="title" v-show="logoTextShow">{{item.name}}</span>
          </template>
          <el-menu-item-group>
            <!--        <el-menu-item index="/admin">管理员管理</el-menu-item>-->
            <div v-for="children in item.children">
              <el-menu-item :index="children.path">
                <i :class="children.icon"></i>
                <span slot="title"> {{children.name}} </span>
              </el-menu-item>
            </div>
          </el-menu-item-group>
        </el-submenu>
      </div>
    </div>

  </el-menu>
</template>

<style>
</style>

<script>
export default {
  name: "Aside",
  props: {
    isCollapse: Boolean,
    logoTextShow: Boolean,
    menus: Array
  },
  data() {
    return {
      opens: this.menus.map(v => v.id + '')
    }
  },
}
</script>